<template>
  <div class="_wz_cent_main _wz_detailsHiddenParts">
    <Card dis-hover :bordered="true" style="margin:0 0 10px;">
      <p slot="title">部位信息</p>
      <Form label-position="right" :label-width="80" >
        <Row>
          <i-col span="3">
            <div style="margin: auto;width: 100px;">
              <div class="_wz_riskPositionFileData">
                <viewer style="width: 100%;height: 100%;">
                  <img :src="!!riskPositionFileData.url ? riskPositionFileData.url:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
                </viewer>
              </div>
              <div style="line-height: 30px;text-align: center;">部位照片</div>
            </div>
          </i-col>
          <i-col span="21">
            <i-col span="8">
              <FormItem label="隐患部位">
                <i-input v-model="riskPositionInfo.riskPositionName" placeholder="--" disabled />
              </FormItem>
            </i-col>
            <i-col span="8">
              <FormItem label="隐患类型">
                <i-input v-model="riskPositionInfo.riskPositionType" placeholder="--" disabled />
              </FormItem>
            </i-col>
            <i-col span="8">
              <FormItem label="特种设备">
                <i-input v-model="riskPositionInfo.riskPositionDeviceState" placeholder="--" disabled />
              </FormItem>
            </i-col>
            <i-col span="8">
              <FormItem label="设施编号">
                <i-input v-model="riskPositionInfo.riskPositionDeviceNo" placeholder="--" disabled />
              </FormItem>
            </i-col>

            <i-col span="8">
              <FormItem label="责任部门">
                <i-input v-model="riskPositionInfo.riskPositionInOrgName" placeholder="--" disabled />
              </FormItem>
            </i-col>
            <i-col span="8">
              <FormItem label="责任人">
                <i-input v-model="riskPositionInfo.riskPositionUserName" placeholder="--" disabled />
              </FormItem>
            </i-col>
            <i-col span="8">
              <FormItem label="隐患区域">
                <i-input v-model="riskPositionInfo.riskPositionSiteLocation" placeholder="--" disabled />
              </FormItem>
            </i-col>
            <i-col span="16">
              <FormItem label="隐患描述">
                <i-input v-model="riskPositionInfo.riskPositionContext" placeholder="--" disabled />
              </FormItem>
            </i-col>
          </i-col>
        </Row>
      </Form>
    </Card>
  </div>
</template>
<script>
export default {
  props: ['selectdata'],//接收来自父组件的数据
  data() {
    return {
      riskPositionInfo:{},
      riskPositionFileData:{//上传照片
        url:'',
      },
    }
  },
  computed: {//计算属性

  },
  beforeCreate() {//beforeCreate创建前状态

  },
  created() {//created创建完毕状态

  },
  beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

  },
  mounted() {//mounted 挂载结束状态
    this.detailsHiddenParts();

  },
  methods: {//执行的方法
    ///risk/position/riskPositionInfo
    detailsHiddenParts(){
      let that = this;
      if(!that.selectdata){
        return false;
      }
      that.axios.post(that.apiUrl.webApi + "/risk/position/riskPositionInfo", {uuid:that.selectdata}).then(res => {
        if (!!res) {
          let data = res.data.data;
          if(!!data.riskPositionSiteImg){
            that.riskPositionFileData = {url:!!data.riskPositionSiteImg?that.apiUrl.imgUrl + data.riskPositionSiteImg:''};
          }
          if(data.riskPositionType == 1){
            data.riskPositionType = '基础管理'
          }else if(data.riskPositionType == 2){
            data.riskPositionType = '设备设施'
          }else if(data.riskPositionType == 3){
            data.riskPositionType = '作业活动'
          }


          if(data.riskPositionDeviceState == 1){
            data.riskPositionDeviceState = '是'
          }else{
            data.riskPositionDeviceState = '否'
          }
          that.riskPositionInfo = data;
        }
      }).catch(err => {
        console.log("失败", err)
      })

    },

  },
  watch: {//监听
    selectdata(news,old){
      this.detailsHiddenParts();
    }
  },
  beforeUpdate() {//beforeUpdate 更新前状态

  },
  updated() {//updated 更新完成状态

  },
  beforeDestroy() {//beforeDestroy 销毁前状态

  },
  destroyed() {//destroyed 销毁完成状态

  }
}
</script>
<style lang="less">
._wz_detailsHiddenParts{

  ._wz_riskPositionFileData {
    margin: auto;
    display: block;
    width: 100px;
    height: 132px;
    text-align: center;
    line-height: 60px;
    border: 1px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    position: relative;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .2);

    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
